# A.TNG

import wsgiref.handlers
import os

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

#import xnsbtx

class MainPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/html'
        self.response.out.write('Hello root')
        self.response.out.write(self.request.headers.items())
        self.response.out.write(self.request.query)
        
class YahooJSTutorialPage(webapp.RequestHandler):
    def get(self):
        self.response.out.write(self.request.query);

class BjcarPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/vnd.wap.wml'
        path = os.path.join(os.path.dirname(__file__), 'tpl_bjcar.wml')
        tpl_value= {
                    'today':'20081106',
                    'tomorrow':'20081107',
                    'dayaftertomorrow':'20081108',
         }
        self.response.out.write(template.render(path, {}))

application = webapp.WSGIApplication([
                                      ('/', MainPage),
                                      ('/jstutorial', YahooJSTutorialPage),
                                      ('/bjcar', BjcarPage),
                                      ], debug=True)

def main():
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
    main()